{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Convergence of Newton's Method"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import numpy as np\n",
        "import matplotlib.pyplot as pt"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "def f(x):\n",
        "    return np.exp(x) - 2\n",
        "\n",
        "def df(x):\n",
        "    return np.exp(x)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "[<matplotlib.lines.Line2D at 0x7fec13f69048>]"
            ]
          },
          "execution_count": 8,
          "metadata": {},
          "output_type": "execute_result"
        },
        {
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAEACAYAAACqOy3+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGitJREFUeJzt3XucVHX9x/HXh0UUtVxBuUjIUmqhYYuRl6gHa1qR5fVh\n3tJHm2h2QdLKW2Z4qUQNoVJJCVn8Jfy8lBdSUUonLz8Co1YkQCDF2EIUFRREWdjv74/vLN8Fl2Vm\nZ+ZcZt7Px+M8Zs7MmZlvH9dPx/f5nnPMOYeIiKRPl7gHICIinaMGLiKSUmrgIiIppQYuIpJSauAi\nIimlBi4iklI5NXAz629mT5jZP81sgZmNzr7ew8xmmdkSM3vMzKpLO1wREWllucwDN7M+QB/nXKOZ\n7Q7MA04AvgGsds5db2aXAHs65y4t6YhFRATIcQ/cOfeKc64x+3wdsAjoBxwHTM1uNhXf1EVEJAJ5\nZ+BmVgMMAeYAvZ1zq7JvrQJ6F21kIiLSobwaeDY++T3wPefc223fcz6L0Xn5IiIR6Zrrhma2E755\n/49z7v7sy6vMrI9z7hUz6wu82s7n1NRFRDrBOWcdvZ/rLBQDJgMLnXMT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li9fHvcQEkO1CFSLQLXIT1GmEZpZDTDDOTe4nfc0h1BEpBN2NI2wa2e/2Mz6OudW\nZldPBJ7vzABERKRzOt3AgevMrBY/G+Ul4LziDElERHJR8jMxRUSkNCI5E9PMbjCzRdkZK38wsz2i\n+N0kMrOvmtk/zWyzmR0S93iiZmYjzGyxmS01s0viHk+czOx2M1tlZu3Gj5XEzPqb2RPZfzcWmNno\nuMcUBzPbxczmmFmjmS00s2s72j6qU+kfAw5yzn0CWAJcFtHvJtHz+GMGT8Y9kKiZWRVwEzACOBA4\n3cwGxTuqWE3B10KgGbjQOXcQcDjw3Ur823DOvQsc6ZyrBQ4GjjSzz2xv+0gauHNulnOuJbs6B/hQ\nFL+bRM65xc65JXGPIyaHAsucc8udc83A/wLHxzym2DjnngLejHscSeCce8U515h9vg5YBOwT76ji\n4Zx7J/u0G1AFvLG9beO4mNXZwMMx/K7Erx+wos16U/Y1kS2y05KH4Hf2Ko6ZdTGzRmAV8IRzbuH2\nti1kFsq2PzoL6NPOWz9yzs3IbnM5sNE5N61Yv5tEudSiQumIuXTIzHYH7gW+l90TrzjZtKI2e6zw\nUTOrc85l2tu2aA3cOff5jt43s3rgGOCoYv1mUu2oFhXsP0D/Nuv98XvhIpjZTsDvgd855+6Pezxx\nc86tNbOHgKFApr1topqFMgK4CDg+G9KLV2knOf0N2N/MasysG3Aq8GDMY5IEMDMDJgMLnXMT4h5P\nXMxsr9brSplZd+DzwD+2t31UGfivgd2BWdlrh98S0e8mjpmdaGYr8EfaHzKzR+IeU1Scc5uAUcCj\nwELgLufconhHFR8zmw78H3CAma0ws2/EPaYYDQPOxM+6qOR7DPQFHs9m4HPwlyj58/Y21ok8IiIp\npVuqiYiklBq4iEhKqYGLiKSUGriISEqpgYuIpJQauIhISqmBi4iklBq4iEhK/T8gm0eyVeQ39QAA\nAABJRU5ErkJggg==\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7fec13f69240>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "xgrid = np.linspace(-2, 3, 1000)\n",
        "pt.grid()\n",
        "pt.plot(xgrid, f(xgrid))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "What's the true solution of $f(x)=0$?"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "0.69314718056\n",
            "0.0\n"
          ]
        }
      ],
      "source": [
        "xtrue = np.log(2)\n",
        "print(xtrue)\n",
        "print(f(xtrue))"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Now let's run Newton's method and keep track of the errors:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "errors = []\n",
        "x = 2"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "At each iteration, print the current guess and the error."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "0.69314718056\n",
            "0.0\n"
          ]
        }
      ],
      "source": [
        "x = x - f(x)/df(x)\n",
        "print(x)\n",
        "errors.append(abs(x-xtrue))\n",
        "print(errors[-1])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "0.577523385913\n",
            "0.13881012318\n",
            "0.00920340345722\n",
            "4.22216905669e-05\n",
            "8.91323015395e-10\n",
            "0.0\n"
          ]
        }
      ],
      "source": [
        "for err in errors:\n",
        "    print(err)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "* Do you have a hypothesis about the order of convergence?"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Doubles number of digits each iteration: probably quadratic."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "------------\n",
        "Let's check:"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 26,
      "metadata": {
        "collapsed": false
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "0.416180751055\n",
            "0.47764604026\n",
            "0.498469622214\n",
            "0.499992953401\n",
            "0.0\n"
          ]
        }
      ],
      "source": [
        "for i in range(len(errors)-1):\n",
        "    print(errors[i+1]/errors[i]**2)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.2+"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}